//
//  pvm.h
//  PVM_emulator
//
//  Created by Pei Liu on 9/11/11.
//  Copyright 2011 __BobbyL__. All rights reserved.
//
//  Memory and all poninters

#ifndef PVM_emulator_pvm_h
#define PVM_emulator_pvm_h

#define MAXCODE 32760
#define MAXMEMO 3000

#include "instruction.h"

//define pointer to function
typedef void (*fcnptr)(int, int);
//define Memory and register
//Memory
int code[MAXCODE] = {0};
//Data
int data[MAXMEMO] = {0};
//register
int reg[3] = {500, 0, 0};
//instruction pointer
int ip = 0;
//stack pointer
int *sp;
//instruction arry
fcnptr instrction[37] = {_pvm_, _mov_, _mvi_, _mif_, _mit_, _lri_, _ldr_, _str_, _mvr_, _add_,
                         _addri_, _sub_, _mul_, _div_, _or_, _and_, _not_, _b_, _beq_, _bne_,_bgt_,
                         _bge_,_blt_, _ble_, _pushd_, _pushr_, _pushi_, _popd_, _popr_,_puti_, _puts_,
                         _line_, _geti_, _gets_, _call_, _ret_, _stop_};
#endif
